home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5764 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: ix.netcom.com!netnews
  2. From: Henry Cross <hcross@ix.netcom.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Can anyone optimize this VERY simple piece of code?
  5. Date: Tue, 20 Feb 1996 18:41:03 -0800
  6. Organization: i586 Box @Irvine, Ca.
  7. Message-ID: <312A863F.49FC@ix.netcom.com>
  8. References: <19950700wnr@samtech.demon.co.uk> <31276E30.26C0@ix.netcom.com> <824842585snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: irv-ca14-13.ix.netcom.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-NETCOM-Date: Tue Feb 20  6:40:11 PM PST 1996
  14. X-Mailer: Mozilla 2.0 (Win95; I)
  15.  
  16. Lawrence Kirby wrote:
  17. > In article <31276E30.26C0@ix.netcom.com>
  18. >            hcross@ix.netcom.com "Henry Cross" writes:
  19. > >>  Personally I'd use a VERY simple language. Assembly!
  20. > > This is a job for inline assembly, compiler allowing, or an assembler
  21. > >if not.
  22. > > However if you must persist in C, use pointers every place possible.
  23. > This hasn't been the case in any reasonable compiler for a number of years
  24. > now.
  25. > > For example vgamem[count] could be a pointer that incremented++ vice
  26. > > an index to an array. (Which is very expensive computationally.)
  27. > The strength reduction required to convert an index to a pointer is one
  28. > of the simpler optimistaion that compilers perform. Code that uses indices
  29. > often provides more information to the compiler for optimisation purposes so
  30. > may even result in better code generated.
  31.  
  32.  Your mileage may vary, according to compiler. The only certain solution
  33. would be to examine the code generated by the compiler with the
  34. appropriate options turned on.
  35.  
  36. regards,
  37. H.Cross
  38.